import {
  HOME_BANNER_LIST,
  HOME_PROD_TAG_LIST,
  HOME_PROD_LIST_BY_TAG_ID
} from '../constants/home'

const INITIAL_STATE = {
  homeBannerList: [],
  homeProdTagList: [],
  homeProdListByTagId: []
}

export default function home(state = INITIAL_STATE, action) {
  switch(action.type) {
    case HOME_BANNER_LIST: {
      return {
        ...state,
        homeBannerList: action.payload
      }
    }
    case HOME_PROD_TAG_LIST: {
      return {
        ...state,
        homeProdTagList: action.payload
      }
    }
    case HOME_PROD_LIST_BY_TAG_ID: {
      return {
        ...state,
        homeProdListByTagId: action.payload
      }
    }
    default:
      return state
  }
}
